//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CBitMemStream {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CBitMemStream(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CBitMemStream obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CBitMemStream(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CBitMemStream(boolean inputStream, long defaultcapacity) {
    this(nelmiscJNI.new_CBitMemStream__SWIG_0(inputStream, defaultcapacity), true);
  }

  public CBitMemStream(boolean inputStream) {
    this(nelmiscJNI.new_CBitMemStream__SWIG_1(inputStream), true);
  }

  public CBitMemStream() {
    this(nelmiscJNI.new_CBitMemStream__SWIG_2(), true);
  }

  public CBitMemStream(CBitMemStream other) {
    this(nelmiscJNI.new_CBitMemStream__SWIG_3(CBitMemStream.getCPtr(other), other), true);
  }

  public CBitMemStream assign(CBitMemStream other) {
    return new CBitMemStream(nelmiscJNI.CBitMemStream_assign(swigCPtr, this, CBitMemStream.getCPtr(other), other), false);
  }

  public void swap(CBitMemStream other) {
    nelmiscJNI.CBitMemStream_swap(swigCPtr, this, CBitMemStream.getCPtr(other), other);
  }

  public void resetBufPos() {
    nelmiscJNI.CBitMemStream_resetBufPos(swigCPtr, this);
  }

  public long length() {
    return nelmiscJNI.CBitMemStream_length(swigCPtr, this);
  }

  public void invert() {
    nelmiscJNI.CBitMemStream_invert(swigCPtr, this);
  }

  public void clear() {
    nelmiscJNI.CBitMemStream_clear(swigCPtr, this);
  }

  public int getPosInBit() {
    return nelmiscJNI.CBitMemStream_getPosInBit(swigCPtr, this);
  }

  public void displayStream(String title, CLog log) {
    nelmiscJNI.CBitMemStream_displayStream__SWIG_0(swigCPtr, this, title, CLog.getCPtr(log), log);
  }

  public void displayStream(String title) {
    nelmiscJNI.CBitMemStream_displayStream__SWIG_1(swigCPtr, this, title);
  }

  public void displayStream() {
    nelmiscJNI.CBitMemStream_displayStream__SWIG_2(swigCPtr, this);
  }

  public void fill(SWIGTYPE_p_unsigned_char srcbuf, long len) {
    nelmiscJNI.CBitMemStream_fill(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(srcbuf), len);
  }

  public SWIGTYPE_p_unsigned_char bufferToFill(long msgsize) {
    long cPtr = nelmiscJNI.CBitMemStream_bufferToFill(swigCPtr, this, msgsize);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public void append(CBitMemStream newBits) {
    nelmiscJNI.CBitMemStream_append(swigCPtr, this, CBitMemStream.getCPtr(newBits), newBits);
  }

  public void serialBuffer(SWIGTYPE_p_unsigned_char buf, long len) {
    nelmiscJNI.CBitMemStream_serialBuffer(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(buf), len);
  }

  public void serialBit(SWIGTYPE_p_bool bit) {
    nelmiscJNI.CBitMemStream_serialBit(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(bit));
  }

  public void serial(SWIGTYPE_p_unsigned_int value, long nbits, boolean resetvalue) {
    nelmiscJNI.CBitMemStream_serial__SWIG_0(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(value), nbits, resetvalue);
  }

  public void serial(SWIGTYPE_p_unsigned_int value, long nbits) {
    nelmiscJNI.CBitMemStream_serial__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(value), nbits);
  }

  public void serial(SWIGTYPE_p_unsigned_long_long value, long nbits) {
    nelmiscJNI.CBitMemStream_serial__SWIG_2(swigCPtr, this, SWIGTYPE_p_unsigned_long_long.getCPtr(value), nbits);
  }

  public int reserve(long byteLen) {
    return nelmiscJNI.CBitMemStream_reserve(swigCPtr, this, byteLen);
  }

  public void reserveBits(long nbits) {
    nelmiscJNI.CBitMemStream_reserveBits(swigCPtr, this, nbits);
  }

  public void poke(long value, long bitpos, long nbits) {
    nelmiscJNI.CBitMemStream_poke(swigCPtr, this, value, bitpos, nbits);
  }

  public void pokeBits(CBitSet bitfield, long bitpos) {
    nelmiscJNI.CBitMemStream_pokeBits(swigCPtr, this, CBitSet.getCPtr(bitfield), bitfield, bitpos);
  }

  public void readBits(CBitSet bitfield) {
    nelmiscJNI.CBitMemStream_readBits(swigCPtr, this, CBitSet.getCPtr(bitfield), bitfield);
  }

  public void displayLastBits(int nbits, int bitpos, CLog log) {
    nelmiscJNI.CBitMemStream_displayLastBits__SWIG_0(swigCPtr, this, nbits, bitpos, CLog.getCPtr(log), log);
  }

  public void displayLastBits(int nbits, int bitpos) {
    nelmiscJNI.CBitMemStream_displayLastBits__SWIG_1(swigCPtr, this, nbits, bitpos);
  }

  public void displayLastBits(int nbits) {
    nelmiscJNI.CBitMemStream_displayLastBits__SWIG_2(swigCPtr, this, nbits);
  }

  public String getSerialItem(TBMSSerialInfo serialItem) {
    return nelmiscJNI.CBitMemStream_getSerialItem(swigCPtr, this, TBMSSerialInfo.getCPtr(serialItem), serialItem);
  }

  public void serial(SWIGTYPE_p_unsigned_char b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_4(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(b));
  }
/*
  public void serial(SWIGTYPE_p_char b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_5(swigCPtr, this, SWIGTYPE_p_char.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_unsigned_int b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_6(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_int b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_7(swigCPtr, this, SWIGTYPE_p_int.getCPtr(b));
  }*/

  public void serial(SWIGTYPE_p_unsigned_int b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_8(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_int b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_9(swigCPtr, this, SWIGTYPE_p_int.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_unsigned_long_long b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_10(swigCPtr, this, SWIGTYPE_p_unsigned_long_long.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_long_long b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_11(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_float b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_12(swigCPtr, this, SWIGTYPE_p_float.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_double b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_13(swigCPtr, this, SWIGTYPE_p_double.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_bool b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_14(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_char b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_15(swigCPtr, this, SWIGTYPE_p_char.getCPtr(b));
  }

  public void serial(SWIGTYPE_p_std__string b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_16(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(b));
  }

  public void serial(ucstring b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_17(swigCPtr, this, ucstring.getCPtr(b), b);
  }

  public void serial(CBitMemStream b) {
    nelmiscJNI.CBitMemStream_serial__SWIG_18(swigCPtr, this, CBitMemStream.getCPtr(b), b);
  }

  public void serialMemStream(CBitMemStream b) {
    nelmiscJNI.CBitMemStream_serialMemStream(swigCPtr, this, CBitMemStream.getCPtr(b), b);
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_unsigned_char_t cont) {
    nelmiscJNI.CBitMemStream_serialCont__SWIG_7(swigCPtr, this, SWIGTYPE_p_std__vectorT_unsigned_char_t.getCPtr(cont));
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_char_t cont) {
    nelmiscJNI.CBitMemStream_serialCont__SWIG_8(swigCPtr, this, SWIGTYPE_p_std__vectorT_char_t.getCPtr(cont));
  }

  public void serialCont(SWIGTYPE_p_std__vectorT_bool_t cont) {
    nelmiscJNI.CBitMemStream_serialCont__SWIG_9(swigCPtr, this, SWIGTYPE_p_std__vectorT_bool_t.getCPtr(cont));
  }

}
